import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {SocialService} from '@delon/auth';

@Component({
    selector: 'app-callback',
    template: ``,
    providers: [SocialService],
})
export class CallbackComponent implements OnInit {
    type: string;

    constructor(
        private socialService: SocialService,
        private route: ActivatedRoute,
        private router: Router,
    ) {
    }

    ngOnInit(): void {
        this.route.params.subscribe(params => {
            this.type = params['type'];
            this.mockModel();
        });
    }

    private mockModel() {
        this.socialService.callback({
            token: '123456789',
            name: 'cipchk',
            email: `${this.type}@${this.type}.com`,
            id: 10000,
            time: +new Date(),
        });
    }
}
